package com.ericom.dao.hibernate;

import org.springframework.stereotype.Repository;

import com.ericom.dao.CategoryDao;
import java.util.List;
import com.ericom.model.Category;
@Repository("categoryDao")
public class CategoryDaoHibernate extends GenericDaoHibernate<Category, Long>
		implements CategoryDao {

	public CategoryDaoHibernate() {
		super(Category.class);
	}

	public List<Category> findByOnline(int online) {
		
		return this.getHibernateTemplate().find("from Category where online=?",online);
	}

	public List<Category> findTopCategory() {
		
		return this.getHibernateTemplate().find("from Category where pid =1");
	}

	public List<Category> findSubCategoryByParentid(Long pid) {
		
		return this.getHibernateTemplate().find("from Category where pid=",pid);
	}

}
